/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.facilscrum.form.dash;

import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JInternalFrame;
import org.facilscrum.form.backlog.BacklogForm;
import org.facilscrum.form.mdi.MDIApplication;

/**
 *
 * @author avbravo
 */
public class DashForm extends javax.swing.JInternalFrame {
  int x, y;
    int screenHeight;
    int screenWidth;
    /**
     * Creates new form DashForm
     */
    public DashForm() {
        initComponents();
         Toolkit tk = Toolkit.getDefaultToolkit();
        Dimension screenSize = tk.getScreenSize();
        this.screenHeight = screenSize.height;
        this.screenWidth = screenSize.width;
        this.x = (int) (this.screenWidth / 4.0);

        //   this.y =(int) (this.screenHeight / 4.0);
        this.y = 70;
        this.x = 120;
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jButtonBacklog = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jTextFieldTermino = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();

        setClosable(true);
        setTitle("Dash");

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jButtonBacklog.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/facilscrum/gif/backlog.png"))); // NOI18N
        jButtonBacklog.setToolTipText("Backlog");
        jButtonBacklog.setFocusable(false);
        jButtonBacklog.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButtonBacklog.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButtonBacklog.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonBacklogActionPerformed(evt);
            }
        });

        jLabel1.setText("Busqueda");

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/facilscrum/gif/search.png"))); // NOI18N
        jButton1.setToolTipText("Buscar");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(jTextFieldTermino, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton1))
                    .addComponent(jButtonBacklog))
                .addContainerGap(254, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(3, 3, 3)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTextFieldTermino, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButtonBacklog, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(348, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 30, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButtonBacklogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBacklogActionPerformed
        BacklogForm backlogForm = new BacklogForm();
        mostrar(backlogForm);
    }//GEN-LAST:event_jButtonBacklogActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButtonBacklog;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextField jTextFieldTermino;
    // End of variables declaration//GEN-END:variables
  private void mostrar(JInternalFrame frame) {
        try {
            frame.setLocation(x, y);
            frame.setVisible(true);
            frame.setSelected(true);
         this.add(frame);
//            MDIApplication.desktopPane.add(frame);
        } catch (Exception ex) {
        }

    }
}
